package com.pig4cloud.pigx.wxApi;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pig4cloud.pigx.admin.api.feign.RemoteUserService;
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
import com.pig4cloud.pigx.ruralLibrary.api.entity.BookUserEntity;
import com.pig4cloud.pigx.ruralLibrary.api.entity.NewUsers;
import com.pig4cloud.pigx.ruralLibrary.api.entity.terrainEntity;
import com.pig4cloud.pigx.ruralLibrary.api.feign.RemoteBookUserService;


import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@SpringBootTest
public class text {
	public static boolean isEnglish(String p) {
		byte[] bytes = p.getBytes();
		int i = bytes.length;//i为字节长度
		int j = p.length();//j为字符长度
		return i == j;
	}


	public static boolean isChinese(String str) throws UnsupportedEncodingException {
		int len = str.length();
		for(int i = 0; i < len; i ++) {
			String temp = URLEncoder.encode(str.charAt(i) + "", "utf-8");
			if(temp.equals(str.charAt(i) + ""))
				continue;
			String[] codes = temp.split("%");
			//判断是中文还是字符(下面判断不精确，部分字符没有包括)
			for(String code : codes) {
				if(code.compareTo("40") > 0)
					return true;
			}
		}
		return false;
	}



}





